<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>用户详情</title>
    <!--/* 加载全局样式 */-->
    <th:block th:replace="common/thinDecorator::globalStyle"></th:block>
    <!--/* 加载全局主题样式 */-->
    <th:block th:replace="common/thinDecorator::globalThemeStyle"></th:block>
    <!--/* 加载全局布局样式 */-->
    <th:block th:replace="common/thinDecorator::globalLayoutStyle"></th:block>
</head>
<body class="page-content-white page-container-bg-solid page-content-form material-blue" style="overflow-x: hidden;">
<div class="page-wrapper">
    <div class="page-container">
        <div class="page-content-wrapper">
            <div class="page-content">
                <div class="row">
                    <div class="col-md-12">
                        <div class="portlet light">
                            <div class="portlet-title">
                                <div class="caption font-blue">
                                    <i class="fa font-blue"></i>数据源信息
                                </div>
                            </div>
                            <div class="portlet-body form">
                                <form id="form" class="horizontal-form" method="post" th:object="${dataInfo}">
                                    <input type="hidden" name="id" id="id" th:value="*{id}"/>
                                    <input type="hidden" name="createTime" id="createTime" th:value="*{createTime}"/>
                                    <input type="hidden" name="creator" id="creator" th:value="*{creator}"/>
                                    <div class="m-grid">
                                        <div class="m-grid-row">
                                            <div class="m-first-col m-grid-col m-grid-col-middle m-grid-col-right m-grid-col-md-1">
                                                <div class="form-label-wrapper">
                                                    <span class="form-label">数据源名称</span>
                                                </div>
                                                <span class="required">*</span>
                                            </div>
                                            <div class="m-grid-col m-grid-col-middle m-grid-col-center m-grid-col-md-3">
                                                <input type="text" class="form-control" placeholder="数据源名称"
                                                       required maxlength="20" name="dataSourceName"
                                                       th:value="*{dataSourceName}" style="width: 80%">
                                            </div>
                                            <div class="m-first-col m-grid-col m-grid-col-middle m-grid-col-right m-grid-col-md-1">
                                                <div class="form-label-wrapper">
                                                    <span class="form-label">数据源类型</span>
                                                </div>
                                                <span class="required">*</span>
                                            </div>
                                            <div class="m-grid-col m-grid-col-middle m-grid-col-center m-grid-col-md-3">
                                                <select id="type" class="easyui-combobox"
                                                        name="dataSourceType" th:field="*{dataSourceType}"
                                                        style="width: 80%; margin: 0px; padding-top: 0px; padding-bottom: 0px; height: 28px; line-height: 30px;">
                                                    <option value="">请选择数据源类型</option>
                                                    <option value="Mysql">Mysql</option>
                                                    <option value="Redis">Redis</option>
                                                    <option value="SqlServer">SqlServer</option>
                                                    <option value="Hive">Hive</option>
                                                    <option value="Oracle">Oracle</option>
                                                </select>
                                            </div>
                                            <div class=" m-grid-col m-grid-col-middle m-grid-col-right m-grid-col-md-1">
                                                <div class="form-label-wrapper">
                                                    <span class="form-label">驱动名称</span>
                                                </div>
                                            </div>
                                            <div class="m-grid-col m-grid-col-middle m-grid-col-center m-grid-col-md-3">
                                                <input id="driverClassName" name="driverClassName"
                                                       th:value="*{driverClassName}" prompt="驱动名称"
                                                       style="width:80%">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="m-grid">
                                        <div class="m-grid-row">
                                            <div class=" m-grid-col m-grid-col-middle m-grid-col-right m-grid-col-md-1">
                                                <div class="form-label-wrapper">
                                                    <span class="form-label">JDBCURL</span>
                                                </div>
                                                <span class="required">*</span>
                                            </div>
                                            <div class="m-grid-col m-grid-col-middle m-grid-col-center m-grid-col-md-3">
                                                <input type="text" class="form-control" placeholder="请输入jdbcUrl"
                                                       name="jdbcUrl" th:value="*{jdbcUrl}" required style="width: 80%">
                                            </div>
                                            <div class=" m-grid-col m-grid-col-middle m-grid-col-right m-grid-col-md-1">
                                                <div class="form-label-wrapper">
                                                    <span class="form-label">用户名</span>
                                                </div>
                                                <span class="required">*</span>
                                            </div>
                                            <div class="m-grid-col m-grid-col-middle m-grid-col-center m-grid-col-md-3">
                                                <input type="text" class="form-control" placeholder="请输入用户名"
                                                       required name="username" th:value="*{username}"
                                                       style="width: 80%"/>
                                            </div>
                                            <div class=" m-grid-col m-grid-col-middle m-grid-col-right m-grid-col-md-1">
                                                <div class="form-label-wrapper">
                                                    <span class="form-label">密码</span>
                                                </div>
                                            </div>
                                            <div class="m-grid-col m-grid-col-middle m-grid-col-center m-grid-col-md-3">
                                                <input class="password" placeholder="请输入密码" name="password" th:value="*{password}"
                                                       style="width: 80%"/>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="m-grid">
                                        <div class="m-grid-row">
                                            <div class="m-first-col m-grid-col m-grid-col-middle m-grid-col-right m-grid-col-md-1">
                                                <div class="form-label-wrapper">
                                                    <span class="form-label">状态</span>
                                                </div>
                                                <span class="required">*</span>
                                            </div>
                                            <div class="m-grid-col m-grid-col-middle m-grid-col-center m-grid-col-md-3">
                                                <select id="connectionStatus" class="easyui-combobox"
                                                        name="connectionStatus" th:field="*{connectionStatus}"
                                                        style="width: 80%; margin: 0px; padding-top: 0px; padding-bottom: 0px; height: 28px; line-height: 30px;">
                                                    <option value="启用">启用</option>
                                                    <option value="禁用">禁用</option>
                                                </select>
                                            </div>
                                            <div class=" m-grid-col m-grid-col-middle m-grid-col-right m-grid-col-md-1">
                                                <div class="form-label-wrapper">
                                                    <span class="form-label">所属人</span>
                                                </div>
                                                <span class="required">*</span>
                                            </div>
                                            <div class="m-grid-col m-grid-col-middle m-grid-col-center m-grid-col-md-3">
                                                <input id="roleNames" class="easyui-textbox" placeholder="所属人"
                                                       name="owner" th:value="*{owner}" style="width: 80%">
                                            </div>
                                            <div class=" m-grid-col m-grid-col-middle m-grid-col-right m-grid-col-md-1">
                                                <div class="form-label-wrapper">
                                                    <span class="form-label">备注</span>
                                                </div>
                                            </div>
                                            <div class="m-grid-col m-grid-col-middle m-grid-col-center m-grid-col-md-3">
                                                notes
                                                <input id="notes" class="easyui-textbox" placeholder="备注" name="notes"
                                                       th:value="*{notes}" style="width: 80%">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-actions">
                                        <div class="col-md-offset-5 col-md-12">
                                            <a href="javascript:;" class="btn green" id="submit">提交</a>
                                            <a href="javascript:back();" class="btn default">返回</a>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
<div id="scripts">
    <!--/* 加载IE8兼容性脚本 */-->
    <th:block th:replace="common/thinDecorator::IE8FixScripts"/>
    <!--/* 加载核心插件脚本 */-->
    <th:block th:replace="common/thinDecorator::corePluginsScripts"/>
    <!--/* 加载全局主题脚本 */-->
    <th:block th:replace="common/thinDecorator::globalThemeScripts"/>
    <!--/* 加载全局布局脚本 */-->
    <th:block th:replace="common/thinDecorator::globalLayoutScripts"/>
    <th:block th:replace="common/thinDecorator::globalsetupScripts"/>
    <script th:inline="javascript">
        var backUrl = "/qa/datasource/list";
        $(function () {
            $("#form").form({
                url: "/qa/datasource/updateOrSave",
                onSubmit: function (params) {
                    var boo = $("#form").form("validate");
                    if (!boo) App.unblockUI();
                    return boo;
                },
                success: function (result) {
                    App.unblockUI();
                    result = JSON.parse(result);
                    if (result && result.code == 200) {
                        //加载层
                        layer.alert('提交成功', {
                            icon: 1				// 0 ~ 6 均可填
                        });
                        back();
                    } else {
                        //信息层
                        layer.msg('表单提交失败', {
                            icon: 2				// -1 ~ 6 均可填
                        });
                    }
                },
                error: function (error) {
                    App.unblockUI();
                    //信息层
                    layer.msg('表单提交失败', {
                        icon: 2				// -1 ~ 6 均可填
                    });
                }
            });

            $("#submit").click(function () {
                App.blockUI({
                    boxed: true,
                    message: "处理中..."
                });
                $("#form").form("submit");
            });

        });

        function back() {
            location.href = backUrl;
        }
    </script>
</div>
<!-- END -->
</body>
</html>